home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 3006 / 3006.xpi / chrome / dwhelper.jar / content / convert-log.xul < prev    next >
Extensible Markup Language  |  2010-01-15  |  3KB  |  83 lines

  1. <?xml version="1.0"?> 
  2. <!-- *****************************************************************************
  3.  *            Copyright (c) 2006-2009 Michel Gutierrez. All Rights Reserved.
  4.  ****************************************************************************** -->
  5. <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
  6. <?xml-stylesheet href="chrome://dwhelper/skin/dwhelper.css" type="text/css"?>
  7. <?xml-stylesheet href="chrome://dwhelper/content/bindings.css" type="text/css"?>
  8.  
  9. <!DOCTYPE window SYSTEM "chrome://dwhelper/locale/dwhelper.dtd" >
  10.  
  11. <window id="dwhelper-convert-log"
  12.         title="&title.conversion-log;"
  13.         flex="1"
  14.         onload="onLoad()"
  15.         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  16.         xmlns:html="http://www.w3.org/1999/xhtml"
  17.         >
  18.  
  19.     <script type="application/x-javascript"
  20.         src="chrome://dwhelper/content/dwhutil.js" />
  21.  
  22.     <script><![CDATA[
  23.  
  24. var Util=Components.classes["@downloadhelper.net/util-service;1"]
  25.     .getService(Components.interfaces.dhIUtilService);
  26.  
  27. var logFile=Util.getProfileDir();
  28. logFile.append("cvhelper.log");
  29.  
  30. function onLoad() {
  31.     loadLog();
  32. }
  33.  
  34. function loadLog() {
  35.     var logPanel=document.getElementById("dwhelper-conv-log-data");
  36.     while(logPanel.firstChild)
  37.         logPanel.removeChild(logPanel.firstChild);
  38.     if(logFile.exists()) {
  39.         var stream = Components.classes['@mozilla.org/network/file-input-stream;1'].
  40.             createInstance(Components.interfaces.nsIFileInputStream);
  41.         stream.init(logFile,1,0,false);
  42.         var scriptableStream = Components.classes['@mozilla.org/scriptableinputstream;1'].createInstance(Components.interfaces.nsIScriptableInputStream);
  43.         scriptableStream.init(stream);
  44.         
  45.         var fileSize = scriptableStream.available();
  46.         var fileContents = scriptableStream.read(fileSize);
  47.     
  48.         scriptableStream.close();
  49.         stream.close();
  50.         
  51.         var logData=document.createTextNode(fileContents);
  52.         logPanel.appendChild(logData);
  53.     }    
  54. }
  55.  
  56. function clearLog() {
  57.     if(logFile.exists())
  58.         logFile.remove(false);
  59.     loadLog();
  60. }
  61.  
  62. ]]>
  63.     </script>
  64.     
  65.     <vbox flex="1">
  66.     
  67.         <box flex="1" style="overflow: auto;background-color: White;">
  68.  
  69.             <html:textarea id="dwhelper-conv-log-data" style="" flex="1" readonly="true"/>
  70.  
  71.         </box>
  72.         
  73.         <hbox style="text-align: right;">
  74.             <spacer flex="1"/>
  75.             <button label="&button.convert-log.clear;" oncommand="clearLog()"/>
  76.             <button label="&button.convert-log.refresh;" oncommand="loadLog()"/>
  77.             <button label="&button.convert-log.close;" oncommand="window.close()"/>
  78.         </hbox>
  79.     
  80.     </vbox>
  81.  
  82. </window>
  83.